def service(a, n, s):
    suma = [0] * s  # 服务器运行时间
    sumawait = [0] * s  # 分配到服务器的等待时间
    nub = 0  # 所有人等待时间
    j = 0  # 服务器索引，初始为0
    for i in range(n):
        suma[j] += a[i]
        sumawait[j] += suma[j]
        j = (j + 1) % s  # 循环服务器索引
    for j in range(s):
        nub += sumawait[j]
    result = nub / n
    return result


if __name__ == "__main__":
    with open('input.txt', 'r') as file:
        lines = file.readlines()
        n, s = map(int, lines[0].split())
        a = list(map(int, lines[1].split()))
    
    a.sort()
    print(service(a, n, s))
    with open("output.txt","w")as file:
        res=service(a, n, s)
        file.write(f"result is :{res}")
